<?php
// +----------------------------------------------------------------------
// | zhanshop-cloud / PaymentTest.php    [ 2025/3/19 17:30 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2025 zhangqiquan All rights reserved.
// +----------------------------------------------------------------------
// | Author: zhangqiquan <768617998@qq.com>
// +----------------------------------------------------------------------
declare (strict_types=1);

namespace test;

use zhanshop\payment\alipay\Pay as Alipay;
use zhanshop\payment\weixin\Pay as Wxpay;
use zhanshop\TestCase;

class PaymentTest extends TestCase
{
    public function testAppalipay()
    {
        $orderId = time().rand(1000,9999);
        $alipay = new Alipay();
        $alipay->setConfig('appid', '2021004136600000');
        $alipay->setConfig('privatekey', 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoI');
        $alipay->setConfig('publickey', 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg9BZz');
        $alipay->setConfig('notify', 'https://aaa.com/v1/trades.callback/zhanshop');
        $result = $alipay->app($orderId, 0.01, [], ['subject' => '测试商品']);
        var_dump($result);
    }
    public function testAppwxpay()
    {
        $orderId = time().rand(1000,9999);
        $wxpay = new Wxpay();
        $wxpay->setConfig('appid', 'wx78af23b9aaaaaa');
        $wxpay->setConfig('mchid', '1670300000');
        $wxpay->setConfig('aeskey', '4fc7e1465710c00000');
        $wxpay->setConfig('serialnum', '79F36E4943825A2800000');
        $wxpay->setConfig('privatekey', '-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv8Vbt1UQrQio2
-----END PRIVATE KEY-----');
        $wxpay->setConfig('publickey', '-----BEGIN CERTIFICATE-----
MIIEKDCCAxCgAwIBAgIUefNuSUOCWih+aqtTpZTXXiguEnMwDQYJKoZIhvcNAQEL
-----END CERTIFICATE-----');
        $wxpay->setConfig('notifyurl', 'https://aaaa.com/v1/trades.callback/zhanshop');
        $result = $wxpay->app($orderId, 0.1, ['subject' => '测试商品']);
        var_dump($result);
    }

    public function testWapalipay()
    {

    }

    public function testWapwxpay()
    {

    }

    public function testNativealipay()
    {

    }

    public function testNativewxpay()
    {

    }
}